<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>children</title>
        <link type="text/css" rel="stylesheet" href='../../css/c1.css'>
        <style>
        p{
            padding:0 10px;
         }
        </style>
        <script src="../../work/jquery-1.12.4.min.js"></script>
        <script>
            jQuery(function ($) {
                $("#btn1",".code").click(function () {
                    $("div").children(".selected").css({backgroundColor:"red"});
                });

            });
        </script>
    </head>
    <body>
    <div class="title">children([expr])</div>
    <p>取得一个包含匹配的元素集合中每一个元素的所有子元素的元素集合</p>
    <p style="font-weight: bold">expr</p>
    <p style="padding:5px 20px;">用于筛选的表达式</p>
    <hr/>
    <div class="title">代码示例</div>
    <div class="code">
                        <pre>

                            &lt;script&gt;
                                jQuery(function ($) {
                                    $("#btn1",).click(function () {
                                         $("div").<span>children(".selected")</span>.css({backgroundColor:"red"});
                                        //<span>在每个div中查找 .selected 的类。</span>
                                    });
                                });
                           &lt;/script&gt;


                                &lt;div&gt;
                                    &lt;p&gt;Hello&lt;/p&gt;
                                    &lt;p class = "selected&gt;Hello Again&lt;/p&gt;
                                    &lt;p&gt;And Again&lt;/p&gt;
                                &lt;/div&gt;
                          &lt;button id="btn1" style="margin: 10px;"&gt;点击查看效果&lt;/button&gt;
                        </pre>
    </div>
    <div class="title">代码示例</div>
    <div class="code">
        <div>
            <p>Hello</p>
            <p class="selected">Hello Again</p>
            <p>And Again</p>
        </div>
        <button id="btn1" style="margin: 10px;">点击查看效果</button>
    </div>
    </body>
</html>